﻿using System;
using System.Web;
using Rabbit.Logic;
using RabbitManage.Code;

namespace RabbitManage.Action
{
    public partial class OrderCancel : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request["id"];
            if (string.IsNullOrEmpty(id)) return;

            HttpCookie cookie = Request.Cookies[Constant.CookieName];
            string shopId = cookie.Values[Constant.CookieUid];

            try
            {
                string error = CriticalLogic.OrderSetCanceled(Db.Store, id, shopId);
                if (!string.IsNullOrEmpty(error))
                {
                    Response.Write(error);
                    return;
                }

                //Response.Write("true");
                Response.Redirect("/UI/MyOrders.aspx");
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
    }
}